<template>
      <div class='tarbar'>
        <van-tabbar v-model="active">
        <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
        <van-tabbar-item icon="medal-o" to="/special">专题</van-tabbar-item>
        <van-tabbar-item icon="qr"  to="/category">分类</van-tabbar-item>
        <van-tabbar-item icon="shopping-cart-o" to="cart">购物车</van-tabbar-item>
        <van-tabbar-item icon="manager-o" to="me">我的</van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script>
export default {
    name:'tar-btn',
    data(){
        return {
            active:0,
        }
    },
    mounted(){
         switch(this.$route.path){
                
                case "/category":
                    this.active = 2;
                    break;
                case '/home':
                    this.active = 0;
                    break;
                case "/cart":
                    this.active = 3;
                    break;
                case "/special":
                    this.active = 1;
                    break;
                case "/me":
                    this.active = 4;
                    break;
                default:
                    this.active = 0;
            }
    }
}
</script>

<style lang="less" scoped>

</style>